package com.arpa.wms.domain.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;

import java.util.HashMap;
import java.util.Map;

/**
 * 收货明细状态
 * @program: wms
 * @description:
 * @author: xuyang
 * @create: 2020-08-20 10:21
 */
public enum ReceiveItemStatusEnum implements IEnum<String> {
    /**
     * 收货单状态
     */
    WAITING_RECEIVE("0", "待收货"),
    PART_RECEIVE("1", "部分收货"),
    FINISH_RECEIVE("2", "收货完成"),
    // 收货确认单状态
    REGISTER_FINISH("1", "已收货");

    /**
     * 值
     */
    private final String value;

    /**
     * 描述
     */
    private final String desc;

    ReceiveItemStatusEnum(final String value, final String desc) {
        this.value = value;
        this.desc = desc;
    }
    private static final Map<String, ReceiveItemStatusEnum> STATUS_MAP = new HashMap();

    static {
        ReceiveItemStatusEnum[] values = values();
        int length = values.length;
        for(int i = 0; i < length; i++){
            ReceiveItemStatusEnum value1 = values[i];
            STATUS_MAP.put(value1.getValue(),value1);
        }
    }

    public static ReceiveItemStatusEnum getEnumByValue(String value){
        return STATUS_MAP.get(value);
    }

    public static ReceiveItemStatusEnum getByValue(String value) {
        for (ReceiveItemStatusEnum item : values()) {
            if (item.getValue().equals(value)) {
                return item;
            }
        }
        return null;
    }


    @Override
    public String getValue() {
        return this.value;
    }

    @Override
    public String toString(){
        return this.desc;
    }

    public String getDesc() {
        return this.desc;
    }
}
